package one.stand.controller;

import one.stand.model.ResultModel;
import one.stand.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
/**
 * @author Administrator
 */
@RestController
@RequestMapping("file")
public class OssController {
    @Autowired
    private OssService ossService;

    /**
     * 上传图片
     */
    @PostMapping(value = "/uploadObjectOSS",produces = {MediaType.APPLICATION_JSON_UTF8_VALUE},consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public ResultModel<String> uploadObjectOSS(@RequestPart MultipartFile file) throws IOException {
        return ossService.upload(file);
    }
}
